<div class="common_form">
	<table cellpadding="0" >
		<tbody>
			<tr>
				<td>
					<?php $this->widget('ext.autowidget'); ?>
					<input type="text" class="autokey" id='search' style="vertical-align: middle;" />&nbsp;&nbsp;
					<select name="type" id="type"  style="float: none;vertical-align: middle;">
						<option value="0">全部</option>
						<option value="1">攻略</option>
						<option value="2">手游</option>
						<option value="3">下载</option>
						<option value="4">补丁</option>
					</select>&nbsp;&nbsp;
					<input type="button" class="default_btn" id='submit'  value="搜索"  style="vertical-align: middle;"/>
				</td>
			</tr>

			<tr><td><div id="videolist"></div></td></tr>
		</tbody>
	</table>
</div>
<script type="text/javascript">
	$("#submit").bind("click",function(){
		var value=$.trim($("#search").val());
		var type=$.trim($("#type").val());
		var str="";
		var result="";
		if(value.length==0) alert("请输入相应关键字！");
		else{
			$.getJSON("/admin/ubutton/ubutton/gettablelist?keyword="+value+"&type="+type+"",function(data){
				for(var i=0;i<data.length;i++){
					str+='<input type="checkbox" name="'+data[i]['title']+'" value="'+html_encode(data[i]['content'])+'">'+data[i]['title']+'<br/>';
				}
				if(parseInt(data)==0) $("#videolist").html("<div style='width:200px;height:100px;line-height:100px; font-weight:bold;font-size:20px;color:#F00;margin:0 auto;'>没有找到相关表格</div>");
				else $("#videolist").html(str);
			});
		}
	});

	function html_encode(str)
	{
		var s = "";
		if (str.length == 0) return "";
		s = str.replace(/"/g, "'");
		return s;
	}
</script>